---
keywords: ""
layout: "default"
title: "Substring"
description: "Swift documentation for 'Substring'"
root: "/v5.1"
---

<div class="intro-declaration"><code class="language-swift">struct Substring</code></div><p>A slice of a string.</p>
<table class="standard"><tr><th id="inheritance">Inheritance</th><td><code class="inherits">CustomDebugStringConvertible, CustomReflectable, CustomStringConvertible, ExpressibleByExtendedGraphemeClusterLiteral, ExpressibleByStringLiteral, ExpressibleByUnicodeScalarLiteral, LosslessStringConvertible, RangeReplaceableCollection, StringProtocol, TextOutputStream, TextOutputStreamable</code></td></tr><tr><th id="aliases">Associated Types</th><td><span id="aliasesmark"></span><div class="declaration"><code class="language-swift">public typealias Index = String.Index</code><div class="comment"><p>Valid indices consist of the position of every element and a
&quot;past the end&quot; position that's not valid for use as a subscript
argument.</p>
</div></div><div class="declaration"><code class="language-swift">public typealias SubSequence = Substring</code><div class="comment"><p>This associated type appears as a requirement in the <code>Sequence</code>
protocol, but it is restated here with stricter constraints. In a
collection, the subsequence should also conform to <code>Collection</code>.</p>
</div></div></td></tr><tr><th>Nested Types</th><td><code class="nested">Substring.UTF8View, Substring.UTF16View, Substring.UnicodeScalarView</code></td></tr></table><div class="discussion comment"><p>When you create a slice of a string, a <code>Substring</code> instance is the result.
Operating on substrings is fast and efficient because a substring shares
its storage with the original string. The <code>Substring</code> type presents the
same interface as <code>String</code>, so you can avoid or defer any copying of the
string's contents.</p>
<p>The following example creates a <code>greeting</code> string, and then finds the
substring of the first sentence:</p>
<pre><code class="language-swift">let greeting = &quot;Hi there! It's nice to meet you! 👋&quot;
let endOfSentence = greeting.firstIndex(of: &quot;!&quot;)!
let firstSentence = greeting[...endOfSentence]
// firstSentence == &quot;Hi there!&quot;
</code></pre>
<p>You can perform many string operations on a substring. Here, we find the
length of the first sentence and create an uppercase version.</p>
<pre><code class="language-swift">print(&quot;'\(firstSentence)' is \(firstSentence.count) characters long.&quot;)
// Prints &quot;'Hi there!' is 9 characters long.&quot;

let shoutingSentence = firstSentence.uppercased()
// shoutingSentence == &quot;HI THERE!&quot;
</code></pre>
<h3>Converting a Substring to a String</h3>
<p>This example defines a <code>rawData</code> string with some unstructured data, and
then uses the string's <code>prefix(while:)</code> method to create a substring of
the numeric prefix:</p>
<pre><code class="language-swift">let rawInput = &quot;126 a.b 22219 zzzzzz&quot;
let numericPrefix = rawInput.prefix(while: { &quot;0&quot;...&quot;9&quot; ~= $0 })
// numericPrefix is the substring &quot;126&quot;
</code></pre>
<p>When you need to store a substring or pass it to a function that requires a
<code>String</code> instance, you can convert it to a <code>String</code> by using the
<code>String(_:)</code> initializer. Calling this initializer copies the contents of
the substring to a new string.</p>
<pre><code class="language-swift">func parseAndAddOne(_ s: String) -&gt; Int {
    return Int(s, radix: 10)! + 1
}
_ = parseAndAddOne(numericPrefix)
// error: cannot convert value...
let incrementedPrefix = parseAndAddOne(String(numericPrefix))
// incrementedPrefix == 127
</code></pre>
<p>Alternatively, you can convert the function that takes a <code>String</code> to one
that is generic over the <code>StringProtocol</code> protocol. The following code
declares a generic version of the <code>parseAndAddOne(_:)</code> function:</p>
<pre><code class="language-swift">func genericParseAndAddOne&lt;S: StringProtocol&gt;(_ s: S) -&gt; Int {
    return Int(s, radix: 10)! + 1
}
let genericallyIncremented = genericParseAndAddOne(numericPrefix)
// genericallyIncremented == 127
</code></pre>
<p>You can call this generic function with an instance of either <code>String</code> or
<code>Substring</code>.</p>
<blockquote>
<p>Important:
Don't store substrings longer than you need them to perform a specific operation. A substring holds a reference to the entire storage of the string it comes from, not just to the portion it presents, even when there is no other reference to the original string. Storing substrings may, therefore, prolong the lifetime of string data that is no longer otherwise accessible, which can appear to be memory leakage.</p>
</blockquote>
</div><h3>Initializers</h3><div id="init-e67906ab4373125a18eb2b5a75f59bd2" class="declaration"><a class="toggle-link" href="#comment-init-e67906ab4373125a18eb2b5a75f59bd2">init init()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-e67906ab4373125a18eb2b5a75f59bd2"><p>Creates an empty substring.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public init()</code></div></div><div id="init-00a2b987552997ee43208aca83ac6ae6" class="declaration"><a class="toggle-link" href="#comment-init-00a2b987552997ee43208aca83ac6ae6">init init(_:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-00a2b987552997ee43208aca83ac6ae6"><p>Instantiates an instance of the conforming type from a string
representation.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(_ content: String)</code></div></div><div id="init-00a2b987552997ee43208aca83ac6ae6" class="declaration"><a class="toggle-link" href="#comment-init-00a2b987552997ee43208aca83ac6ae6">init init(_:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-00a2b987552997ee43208aca83ac6ae6"><p>Creates a new instance of a collection containing the elements of a
sequence.</p>
<ul>
<li>Parameter elements: The sequence of elements for the new collection.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public init&lt;S>(_ elements: S) where S: Sequence, Self.Element == S.Element</code></div></div><div id="init-00a2b987552997ee43208aca83ac6ae6" class="declaration"><a class="toggle-link" href="#comment-init-00a2b987552997ee43208aca83ac6ae6">init init(_:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-00a2b987552997ee43208aca83ac6ae6"><p>Creates a Substring having the given content.</p>
<blockquote>
<p>Complexity:
O(1)</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">public init(_ content: Substring.UTF8View)</code></div></div><div id="init-00a2b987552997ee43208aca83ac6ae6" class="declaration"><a class="toggle-link" href="#comment-init-00a2b987552997ee43208aca83ac6ae6">init init(_:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-00a2b987552997ee43208aca83ac6ae6"><p>Creates a Substring having the given content.</p>
<blockquote>
<p>Complexity:
O(1)</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">public init(_ content: Substring.UTF16View)</code></div></div><div id="init-00a2b987552997ee43208aca83ac6ae6" class="declaration"><a class="toggle-link" href="#comment-init-00a2b987552997ee43208aca83ac6ae6">init init(_:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-00a2b987552997ee43208aca83ac6ae6"><p>Creates a Substring having the given content.</p>
<blockquote>
<p>Complexity:
O(1)</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">public init(_ content: Substring.UnicodeScalarView)</code></div></div><div id="init-00a2b987552997ee43208aca83ac6ae6" class="declaration"><a class="toggle-link" href="#comment-init-00a2b987552997ee43208aca83ac6ae6">init init(_:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-00a2b987552997ee43208aca83ac6ae6"><p>Creates a new instance of a collection containing the elements of a
sequence.</p>
<ul>
<li>Parameter elements: The sequence of elements for the new collection.
<code>elements</code> must be finite.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public init&lt;S>(_ elements: S) where S: Sequence, S.Element == Character</code></div></div><div id="init_cString-58864c26f194dbf4c57e94ac2a9fe21b" class="declaration"><a class="toggle-link" href="#comment-init_cString-58864c26f194dbf4c57e94ac2a9fe21b">init init(cString:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_cString-58864c26f194dbf4c57e94ac2a9fe21b"><p>Creates a string from the null-terminated, UTF-8 encoded sequence of
bytes at the given pointer.</p>
<ul>
<li>Parameter nullTerminatedUTF8: A pointer to a sequence of contiguous,
UTF-8 encoded bytes ending just before the first zero byte.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public init(cString nullTerminatedUTF8: UnsafePointer&lt;CChar>)</code></div></div><div id="init_decoding_as-31e3ddbd83c6dda492b07376979509b4" class="declaration"><a class="toggle-link" href="#comment-init_decoding_as-31e3ddbd83c6dda492b07376979509b4">init init(decoding:as:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_decoding_as-31e3ddbd83c6dda492b07376979509b4"><p>Creates a string from the given Unicode code units in the specified
encoding.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public init&lt;C, Encoding>(decoding codeUnits: C, as sourceEncoding: Encoding.Type) where C: Collection, Encoding: _UnicodeEncoding, C.Element == Encoding.CodeUnit</code></div></div><div id="init_decodingCString_as-927a148198368771afe270469643556f" class="declaration"><a class="toggle-link" href="#comment-init_decodingCString_as-927a148198368771afe270469643556f">init init(decodingCString:as:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_decodingCString_as-927a148198368771afe270469643556f"><p>Creates a string from the null-terminated sequence of bytes at the given
pointer.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public init&lt;Encoding>(decodingCString nullTerminatedCodeUnits: UnsafePointer&lt;Encoding.CodeUnit>, as sourceEncoding: Encoding.Type) where Encoding: _UnicodeEncoding</code></div></div><div id="init_extendedGraphemeClusterLiteral-ce80f4b8568526286f936ef1e08aa545" class="declaration"><a class="toggle-link" href="#comment-init_extendedGraphemeClusterLiteral-ce80f4b8568526286f936ef1e08aa545">init init(extendedGraphemeClusterLiteral:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_extendedGraphemeClusterLiteral-ce80f4b8568526286f936ef1e08aa545"><p>Creates an instance initialized to the given value.</p>
<ul>
<li>Parameter value: The value of the new instance.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(extendedGraphemeClusterLiteral value: String)</code></div></div><div id="init_repeating_count-386429a7befa4cc7818e4639b5637091" class="declaration"><a class="toggle-link" href="#comment-init_repeating_count-386429a7befa4cc7818e4639b5637091">init init(repeating:count:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_repeating_count-386429a7befa4cc7818e4639b5637091"><p>Creates a new collection containing the specified number of a single,
repeated value.</p>
<p>Here's an example of creating an array initialized with five strings
containing the letter <em>Z</em>.</p>
<pre><code class="language-swift">let fiveZs = Array(repeating: &quot;Z&quot;, count: 5)
print(fiveZs)
// Prints &quot;[&quot;Z&quot;, &quot;Z&quot;, &quot;Z&quot;, &quot;Z&quot;, &quot;Z&quot;]&quot;
</code></pre>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(repeating repeatedValue: Self.Element, count: Int)</code></div></div><div id="init_stringInterpolation-43b771a40606e1d1ba75f6a22de5ca57" class="declaration"><a class="toggle-link" href="#comment-init_stringInterpolation-43b771a40606e1d1ba75f6a22de5ca57">init init(stringInterpolation:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_stringInterpolation-43b771a40606e1d1ba75f6a22de5ca57"><p>Creates a new instance from an interpolated string literal.</p>
<p>Do not call this initializer directly. It is used by the compiler when
you create a string using string interpolation. Instead, use string
interpolation to create a new string by including values, literals,
variables, or expressions enclosed in parentheses, prefixed by a
backslash (<code>\(</code>...<code>)</code>).</p>
<pre><code class="language-swift">let price = 2
let number = 3
let message = &quot;&quot;&quot;
              If one cookie costs \(price) dollars, \
              \(number) cookies cost \(price * number) dollars.
              &quot;&quot;&quot;
print(message)
// Prints &quot;If one cookie costs 2 dollars, 3 cookies cost 6 dollars.&quot;
</code></pre>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(stringInterpolation: DefaultStringInterpolation)</code></div></div><div id="init_stringLiteral-a150a34163a566e92846a108f6703cde" class="declaration"><a class="toggle-link" href="#comment-init_stringLiteral-a150a34163a566e92846a108f6703cde">init init(stringLiteral:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_stringLiteral-a150a34163a566e92846a108f6703cde"><p>Creates an instance initialized to the given string value.</p>
<ul>
<li>Parameter value: The value of the new instance.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(stringLiteral value: String)</code></div></div><div id="init_unicodeScalarLiteral-dab818ff6fb6437e4888e0483fe7b2eb" class="declaration"><a class="toggle-link" href="#comment-init_unicodeScalarLiteral-dab818ff6fb6437e4888e0483fe7b2eb">init init(unicodeScalarLiteral:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_unicodeScalarLiteral-dab818ff6fb6437e4888e0483fe7b2eb"><p>Creates an instance initialized to the given value.</p>
<ul>
<li>Parameter value: The value of the new instance.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(unicodeScalarLiteral value: String)</code></div></div><h3>Instance Variables</h3><div id="base-593616de15330c0fb2d55e55410bf994" class="declaration"><a class="toggle-link" href="#comment-base-593616de15330c0fb2d55e55410bf994">var base</a> <span class="required">Required</span><div class="comment collapse in" id="comment-base-593616de15330c0fb2d55e55410bf994"><p>Returns the underlying string from which this Substring was derived.</p>
<h4>Declaration</h4><code class="language-swift">var base: String</code></div></div><div id="customMirror-c4bea5adb1649887b1a7e9972736e2a9" class="declaration"><a class="toggle-link" href="#comment-customMirror-c4bea5adb1649887b1a7e9972736e2a9">var customMirror</a> <span class="required">Required</span><div class="comment collapse in" id="comment-customMirror-c4bea5adb1649887b1a7e9972736e2a9"><p>The custom mirror for this instance.</p>
<p>If this type has value semantics, the mirror should be unaffected by
subsequent mutations of the instance.</p>
<h4>Declaration</h4><code class="language-swift">var customMirror: Mirror</code></div></div><div id="customPlaygroundQuickLook-f9753f8429ddbf38426ca2eda101c4d3" class="declaration"><a class="toggle-link" href="#comment-customPlaygroundQuickLook-f9753f8429ddbf38426ca2eda101c4d3">var customPlaygroundQuickLook</a> <span class="required">Required</span><div class="comment collapse in" id="comment-customPlaygroundQuickLook-f9753f8429ddbf38426ca2eda101c4d3"><p>A custom playground Quick Look for this instance.</p>
<p>If this type has value semantics, the <code>PlaygroundQuickLook</code> instance
should be unaffected by subsequent mutations.</p>
<h4>Declaration</h4><code class="language-swift">var customPlaygroundQuickLook: _PlaygroundQuickLook</code></div></div><div id="debugDescription-15dc1a07010ea28e38b1f4d74663fe11" class="declaration"><a class="toggle-link" href="#comment-debugDescription-15dc1a07010ea28e38b1f4d74663fe11">var debugDescription</a> <span class="required">Required</span><div class="comment collapse in" id="comment-debugDescription-15dc1a07010ea28e38b1f4d74663fe11"><p>A textual representation of this instance, suitable for debugging.</p>
<p>Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the <code>String(reflecting:)</code>
initializer. This initializer works with any type, and uses the custom
<code>debugDescription</code> property for types that conform to
<code>CustomDebugStringConvertible</code>:</p>
<pre><code class="language-swift">struct Point: CustomDebugStringConvertible {
    let x: Int, y: Int

    var debugDescription: String {
        return &quot;(\(x), \(y))&quot;
    }
}

let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints &quot;(21, 30)&quot;
</code></pre>
<p>The conversion of <code>p</code> to a string in the assignment to <code>s</code> uses the
<code>Point</code> type's <code>debugDescription</code> property.</p>
<h4>Declaration</h4><code class="language-swift">var debugDescription: String</code></div></div><div id="description-67daf92c833c41c95db874e18fcb2786" class="declaration"><a class="toggle-link" href="#comment-description-67daf92c833c41c95db874e18fcb2786">var description</a> <span class="required">Required</span><div class="comment collapse in" id="comment-description-67daf92c833c41c95db874e18fcb2786"><p>A textual representation of this instance.</p>
<p>Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the <code>String(describing:)</code>
initializer. This initializer works with any type, and uses the custom
<code>description</code> property for types that conform to
<code>CustomStringConvertible</code>:</p>
<pre><code class="language-swift">struct Point: CustomStringConvertible {
    let x: Int, y: Int

    var description: String {
        return &quot;(\(x), \(y))&quot;
    }
}

let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints &quot;(21, 30)&quot;
</code></pre>
<p>The conversion of <code>p</code> to a string in the assignment to <code>s</code> uses the
<code>Point</code> type's <code>description</code> property.</p>
<h4>Declaration</h4><code class="language-swift">var description: String</code></div></div><div id="endIndex-6c7c6ecf23a364eb2ec70b77c92e7a4e" class="declaration"><a class="toggle-link" href="#comment-endIndex-6c7c6ecf23a364eb2ec70b77c92e7a4e">var endIndex</a> <span class="required">Required</span><div class="comment collapse in" id="comment-endIndex-6c7c6ecf23a364eb2ec70b77c92e7a4e"><p>The collection's &quot;past the end&quot; position---that is, the position one
greater than the last valid subscript argument.</p>
<p>When you need a range that includes the last element of a collection, use
the half-open range operator (<code>..&lt;</code>) with <code>endIndex</code>. The <code>..&lt;</code> operator
creates a range that doesn't include the upper bound, so it's always
safe to use with <code>endIndex</code>. For example:</p>
<pre><code class="language-swift">let numbers = [10, 20, 30, 40, 50]
if let index = numbers.firstIndex(of: 30) {
    print(numbers[index ..&lt; numbers.endIndex])
}
// Prints &quot;[30, 40, 50]&quot;
</code></pre>
<p>If the collection is empty, <code>endIndex</code> is equal to <code>startIndex</code>.</p>
<h4>Declaration</h4><code class="language-swift">var endIndex: Substring.Index</code></div></div><div id="isContiguousUTF-fbd1cae90f14352fc30517618be2b3e1" class="declaration"><a class="toggle-link" href="#comment-isContiguousUTF-fbd1cae90f14352fc30517618be2b3e1">var isContiguousUTF8</a> <span class="required">Required</span><div class="comment collapse in" id="comment-isContiguousUTF-fbd1cae90f14352fc30517618be2b3e1"><p>Returns whether this string is capable of providing access to
validly-encoded UTF-8 contents in contiguous memory in O(1) time.</p>
<p>Contiguous strings always operate in O(1) time for withUTF8 and always
give a result for String.UTF8View.withContiguousStorageIfAvailable.
Contiguous strings also benefit from fast-paths and better optimizations.</p>
<h4>Declaration</h4><code class="language-swift">var isContiguousUTF8: Bool</code></div></div><div id="startIndex-04d77ddd9c9389cc56939726d3da8089" class="declaration"><a class="toggle-link" href="#comment-startIndex-04d77ddd9c9389cc56939726d3da8089">var startIndex</a> <span class="required">Required</span><div class="comment collapse in" id="comment-startIndex-04d77ddd9c9389cc56939726d3da8089"><p>The position of the first element in a nonempty collection.</p>
<p>If the collection is empty, <code>startIndex</code> is equal to <code>endIndex</code>.</p>
<h4>Declaration</h4><code class="language-swift">var startIndex: Substring.Index</code></div></div><div id="unicodeScalars-bb9adb223a5d0705cdb539e7fb533ea2" class="declaration"><a class="toggle-link" href="#comment-unicodeScalars-bb9adb223a5d0705cdb539e7fb533ea2">var unicodeScalars</a> <span class="required">Required</span><div class="comment collapse in" id="comment-unicodeScalars-bb9adb223a5d0705cdb539e7fb533ea2"><h4>Declaration</h4><code class="language-swift">var unicodeScalars: Substring.UnicodeScalarView</code></div></div><div id="utf-5ab39c2bd546655547f6101ed91e395e" class="declaration"><a class="toggle-link" href="#comment-utf-5ab39c2bd546655547f6101ed91e395e">var utf16</a> <span class="required">Required</span><div class="comment collapse in" id="comment-utf-5ab39c2bd546655547f6101ed91e395e"><h4>Declaration</h4><code class="language-swift">var utf16: Substring.UTF16View</code></div></div><div id="utf-30df7f629fcf6b940bcaef5faf2490bb" class="declaration"><a class="toggle-link" href="#comment-utf-30df7f629fcf6b940bcaef5faf2490bb">var utf8</a> <span class="required">Required</span><div class="comment collapse in" id="comment-utf-30df7f629fcf6b940bcaef5faf2490bb"><h4>Declaration</h4><code class="language-swift">var utf8: Substring.UTF8View</code></div></div><h3>Subscripts</h3><div id="subscript_i-c92365e25f38d226feb13e8a5783416f" class="declaration"><a class="toggle-link" href="#comment-subscript_i-c92365e25f38d226feb13e8a5783416f">subscript subscript(i:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_i-c92365e25f38d226feb13e8a5783416f"><p>Accesses the element at the specified position.</p>
<p>The following example accesses an element of an array through its
subscript to print its value:</p>
<pre><code class="language-swift">var streets = [&quot;Adams&quot;, &quot;Bryant&quot;, &quot;Channing&quot;, &quot;Douglas&quot;, &quot;Evarts&quot;]
print(streets[1])
// Prints &quot;Bryant&quot;
</code></pre>
<p>You can subscript a collection with any valid index other than the
collection's end index. The end index refers to the position one past
the last element of a collection, so it doesn't correspond with an
element.</p>
<ul>
<li>Parameter position: The position of the element to access. <code>position</code>
must be a valid index of the collection that is not equal to the
<code>endIndex</code> property.</li>
</ul>
<blockquote>
<p>Complexity:
O(1)</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">public subscript(i: Substring.Index) -> Character</code></div></div><div id="subscript_r-466c73e996c8d896f1c6a25f9add8052" class="declaration"><a class="toggle-link" href="#comment-subscript_r-466c73e996c8d896f1c6a25f9add8052">subscript subscript(r:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_r-466c73e996c8d896f1c6a25f9add8052"><p>Accesses a contiguous subrange of the collection's elements.</p>
<p>The accessed slice uses the same indices for the same elements as the
original collection uses. Always use the slice's <code>startIndex</code> property
instead of assuming that its indices start at a particular value.</p>
<p>This example demonstrates getting a slice of an array of strings, finding
the index of one of the strings in the slice, and then using that index
in the original array.</p>
<pre><code class="language-swift">let streets = [&quot;Adams&quot;, &quot;Bryant&quot;, &quot;Channing&quot;, &quot;Douglas&quot;, &quot;Evarts&quot;]
let streetsSlice = streets[2 ..&lt; streets.endIndex]
print(streetsSlice)
// Prints &quot;[&quot;Channing&quot;, &quot;Douglas&quot;, &quot;Evarts&quot;]&quot;

let index = streetsSlice.firstIndex(of: &quot;Evarts&quot;)    // 4
print(streets[index!])
// Prints &quot;Evarts&quot;
</code></pre>
<ul>
<li>Parameter bounds: A range of the collection's indices. The bounds of
the range must be valid indices of the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(1)</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@available(swift 4) @inlinable public subscript(r: Range&lt;Substring.Index>) -> Substring</code></div></div><h3>Instance Methods</h3><div id="append-1fd0af8599f8632e7a2669725979f22c" class="declaration"><a class="toggle-link" href="#comment-append-1fd0af8599f8632e7a2669725979f22c">func append(_ newElement: Self.Element)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-append-1fd0af8599f8632e7a2669725979f22c"><p>Adds an element to the end of the collection.</p>
<p>If the collection does not have sufficient capacity for another element,
additional storage is allocated before appending <code>newElement</code>. The
following example adds a new number to an array of integers:</p>
<pre><code class="language-swift">var numbers = [1, 2, 3, 4, 5]
numbers.append(100)

print(numbers)
// Prints &quot;[1, 2, 3, 4, 5, 100]&quot;
</code></pre>
<ul>
<li>Parameter newElement: The element to append to the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(1) on average, over many calls to <code>append(_:)</code> on the same collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func append(_ newElement: Self.Element)</code></div></div><div id="append_contentsOf-ac3371fb120478d23360c9cd8a715233" class="declaration"><a class="toggle-link" href="#comment-append_contentsOf-ac3371fb120478d23360c9cd8a715233">func append(contentsOf newElements: S)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-append_contentsOf-ac3371fb120478d23360c9cd8a715233"><p>Adds the elements of a sequence or collection to the end of this
collection.</p>
<p>The collection being appended to allocates any additional necessary
storage to hold the new elements.</p>
<p>The following example appends the elements of a <code>Range&lt;Int&gt;</code> instance to
an array of integers:</p>
<pre><code class="language-swift">var numbers = [1, 2, 3, 4, 5]
numbers.append(contentsOf: 10...15)
print(numbers)
// Prints &quot;[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]&quot;
</code></pre>
<ul>
<li>Parameter newElements: The elements to append to the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>m</em>), where <em>m</em> is the length of <code>newElements</code>.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func append&lt;S>(contentsOf newElements: S) where S: Sequence, Self.Element == S.Element</code></div></div><div id="append_contentsOf-ac3371fb120478d23360c9cd8a715233" class="declaration"><a class="toggle-link" href="#comment-append_contentsOf-ac3371fb120478d23360c9cd8a715233">func append(contentsOf elements: S)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-append_contentsOf-ac3371fb120478d23360c9cd8a715233"><p>Adds the elements of a sequence or collection to the end of this
collection.</p>
<p>The collection being appended to allocates any additional necessary
storage to hold the new elements.</p>
<p>The following example appends the elements of a <code>Range&lt;Int&gt;</code> instance to
an array of integers:</p>
<pre><code class="language-swift">var numbers = [1, 2, 3, 4, 5]
numbers.append(contentsOf: 10...15)
print(numbers)
// Prints &quot;[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]&quot;
</code></pre>
<ul>
<li>Parameter newElements: The elements to append to the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>m</em>), where <em>m</em> is the length of <code>newElements</code>.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func append&lt;S>(contentsOf elements: S) where S: Sequence, S.Element == Character</code></div></div><div id="applying-4859fa95d24831da77250741f009e926" class="declaration"><a class="toggle-link" href="#comment-applying-4859fa95d24831da77250741f009e926">func applying(_ difference: CollectionDifference&lt;Self.Element>) -> Self?</a> <span class="required">Required</span><div class="comment collapse in" id="comment-applying-4859fa95d24831da77250741f009e926"><p>Applies the given difference to this collection.</p>
<ul>
<li>Parameter difference: The difference to be applied.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em> + <em>c</em>), where <em>n</em> is <code>self.count</code> and <em>c</em> is the number of changes contained by the parameter.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@available(OSX 10.15, iOS 13, tvOS 13, watchOS 6, *) public func applying(_ difference: CollectionDifference&lt;Self.Element>) -> Self?</code></div></div><div id="distance_from_to-a4fda42879a53b11f7add335ae2b09e2" class="declaration"><a class="toggle-link" href="#comment-distance_from_to-a4fda42879a53b11f7add335ae2b09e2">func distance(from start: Substring.Index, to end: Substring.Index) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-distance_from_to-a4fda42879a53b11f7add335ae2b09e2"><p>Returns the distance between two indices.</p>
<p>Unless the collection conforms to the <code>BidirectionalCollection</code> protocol,
<code>start</code> must be less than or equal to <code>end</code>.</p>
<blockquote>
<p>Complexity:
O(1) if the collection conforms to <code>RandomAccessCollection</code>; otherwise, O(<em>k</em>), where <em>k</em> is the resulting distance.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public func distance(from start: Substring.Index, to end: Substring.Index) -> Int</code></div></div><div id="filter-1c174b73935eda6461cafaf0555f7dfd" class="declaration"><a class="toggle-link" href="#comment-filter-1c174b73935eda6461cafaf0555f7dfd">func filter(_ isIncluded: (Self.Element) throws -> Bool) rethrows -> Self</a> <span class="required">Required</span><div class="comment collapse in" id="comment-filter-1c174b73935eda6461cafaf0555f7dfd"><p>Returns a new collection of the same type containing, in order, the
elements of the original collection that satisfy the given predicate.</p>
<p>In this example, <code>filter(_:)</code> is used to include only names shorter than
five characters.</p>
<pre><code class="language-swift">let cast = [&quot;Vivien&quot;, &quot;Marlon&quot;, &quot;Kim&quot;, &quot;Karl&quot;]
let shortNames = cast.filter { $0.count &lt; 5 }
print(shortNames)
// Prints &quot;[&quot;Kim&quot;, &quot;Karl&quot;]&quot;
</code></pre>
<ul>
<li>Parameter isIncluded: A closure that takes an element of the
sequence as its argument and returns a Boolean value indicating
whether the element should be included in the returned collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@available(swift 4.0) @inlinable public func filter(_ isIncluded: (Self.Element) throws -> Bool) rethrows -> Self</code></div></div><div id="filter-1c174b73935eda6461cafaf0555f7dfd" class="declaration"><a class="toggle-link" href="#comment-filter-1c174b73935eda6461cafaf0555f7dfd">func filter(_ isIncluded: (Substring.Element) throws -> Bool) rethrows -> String</a> <span class="required">Required</span><div class="comment collapse in" id="comment-filter-1c174b73935eda6461cafaf0555f7dfd"><h4>Declaration</h4><code class="language-swift">public func filter(_ isIncluded: (Substring.Element) throws -> Bool) rethrows -> String</code></div></div><div id="hasPrefix-2c330b117aea3d7648825fa75e2003e0" class="declaration"><a class="toggle-link" href="#comment-hasPrefix-2c330b117aea3d7648825fa75e2003e0">func hasPrefix(_ prefix: Prefix) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-hasPrefix-2c330b117aea3d7648825fa75e2003e0"><p>Returns a Boolean value indicating whether the string begins with the
specified prefix.</p>
<p>The comparison is both case sensitive and Unicode safe. The
case-sensitive comparison will only match strings whose corresponding
characters have the same case.</p>
<pre><code class="language-swift">let cafe = &quot;Café du Monde&quot;

// Case sensitive
print(cafe.hasPrefix(&quot;café&quot;))
// Prints &quot;false&quot;
</code></pre>
<p>The Unicode-safe comparison matches Unicode extended grapheme clusters
rather than the code points used to compose them. The example below uses
two strings with different forms of the <code>&quot;é&quot;</code> character---the first uses
the composed form and the second uses the decomposed form.</p>
<pre><code class="language-swift">// Unicode safe
let composedCafe = &quot;Café&quot;
let decomposedCafe = &quot;Cafe\u{0301}&quot;

print(cafe.hasPrefix(composedCafe))
// Prints &quot;true&quot;
print(cafe.hasPrefix(decomposedCafe))
// Prints &quot;true&quot;
</code></pre>
<ul>
<li>Parameter prefix: A possible prefix to test against this string.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public func hasPrefix&lt;Prefix>(_ prefix: Prefix) -> Bool where Prefix: StringProtocol</code></div></div><div id="hasSuffix-24c7a481465f55f55e2d4ec26c610960" class="declaration"><a class="toggle-link" href="#comment-hasSuffix-24c7a481465f55f55e2d4ec26c610960">func hasSuffix(_ suffix: Suffix) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-hasSuffix-24c7a481465f55f55e2d4ec26c610960"><p>Returns a Boolean value indicating whether the string ends with the
specified suffix.</p>
<p>The comparison is both case sensitive and Unicode safe. The
case-sensitive comparison will only match strings whose corresponding
characters have the same case.</p>
<pre><code class="language-swift">let plans = &quot;Let's meet at the café&quot;

// Case sensitive
print(plans.hasSuffix(&quot;Café&quot;))
// Prints &quot;false&quot;
</code></pre>
<p>The Unicode-safe comparison matches Unicode extended grapheme clusters
rather than the code points used to compose them. The example below uses
two strings with different forms of the <code>&quot;é&quot;</code> character---the first uses
the composed form and the second uses the decomposed form.</p>
<pre><code class="language-swift">// Unicode safe
let composedCafe = &quot;café&quot;
let decomposedCafe = &quot;cafe\u{0301}&quot;

print(plans.hasSuffix(composedCafe))
// Prints &quot;true&quot;
print(plans.hasSuffix(decomposedCafe))
// Prints &quot;true&quot;
</code></pre>
<ul>
<li>Parameter suffix: A possible suffix to test against this string.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public func hasSuffix&lt;Suffix>(_ suffix: Suffix) -> Bool where Suffix: StringProtocol</code></div></div><div id="hash_into-6d50cb3daa41162a12fb4542a687b393" class="declaration"><a class="toggle-link" href="#comment-hash_into-6d50cb3daa41162a12fb4542a687b393">func hash(into hasher: inout Hasher)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-hash_into-6d50cb3daa41162a12fb4542a687b393"><p>Hashes the essential components of this value by feeding them into the
given hasher.</p>
<ul>
<li>Parameter hasher: The hasher to use when combining the components
of this instance.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public func hash(into hasher: inout Hasher)</code></div></div><div id="index_offsetBy-41a458d51308012c8383ec58b39fc85a" class="declaration"><a class="toggle-link" href="#comment-index_offsetBy-41a458d51308012c8383ec58b39fc85a">func index(_ i: Substring.Index, offsetBy n: Int) -> Substring.Index</a> <span class="required">Required</span><div class="comment collapse in" id="comment-index_offsetBy-41a458d51308012c8383ec58b39fc85a"><p>Returns an index that is the specified distance from the given index.</p>
<p>The following example obtains an index advanced four positions from a
string's starting index and then prints the character at that position.</p>
<pre><code class="language-swift">let s = &quot;Swift&quot;
let i = s.index(s.startIndex, offsetBy: 4)
print(s[i])
// Prints &quot;t&quot;
</code></pre>
<p>The value passed as <code>distance</code> must not offset <code>i</code> beyond the bounds of
the collection.</p>
<blockquote>
<p>Complexity:
O(1) if the collection conforms to <code>RandomAccessCollection</code>; otherwise, O(<em>k</em>), where <em>k</em> is the absolute value of <code>distance</code>.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public func index(_ i: Substring.Index, offsetBy n: Int) -> Substring.Index</code></div></div><div id="index_offsetBy_limitedBy-c29af88d32684042c610f5da0fa07130" class="declaration"><a class="toggle-link" href="#comment-index_offsetBy_limitedBy-c29af88d32684042c610f5da0fa07130">func index(_ i: Substring.Index, offsetBy n: Int, limitedBy limit: Substring.Index) -> Substring.Index?</a> <span class="required">Required</span><div class="comment collapse in" id="comment-index_offsetBy_limitedBy-c29af88d32684042c610f5da0fa07130"><p>Returns an index that is the specified distance from the given index,
unless that distance is beyond a given limiting index.</p>
<p>The following example obtains an index advanced four positions from a
string's starting index and then prints the character at that position.
The operation doesn't require going beyond the limiting <code>s.endIndex</code>
value, so it succeeds.</p>
<pre><code class="language-swift">let s = &quot;Swift&quot;
if let i = s.index(s.startIndex, offsetBy: 4, limitedBy: s.endIndex) {
    print(s[i])
}
// Prints &quot;t&quot;
</code></pre>
<p>The next example attempts to retrieve an index six positions from
<code>s.startIndex</code> but fails, because that distance is beyond the index
passed as <code>limit</code>.</p>
<pre><code class="language-swift">let j = s.index(s.startIndex, offsetBy: 6, limitedBy: s.endIndex)
print(j)
// Prints &quot;nil&quot;
</code></pre>
<p>The value passed as <code>distance</code> must not offset <code>i</code> beyond the bounds of
the collection, unless the index passed as <code>limit</code> prevents offsetting
beyond those bounds.</p>
<blockquote>
<p>Complexity:
O(1) if the collection conforms to <code>RandomAccessCollection</code>; otherwise, O(<em>k</em>), where <em>k</em> is the absolute value of <code>distance</code>.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public func index(_ i: Substring.Index, offsetBy n: Int, limitedBy limit: Substring.Index) -> Substring.Index?</code></div></div><div id="index_after-976478ce790c064a72519919a525cb29" class="declaration"><a class="toggle-link" href="#comment-index_after-976478ce790c064a72519919a525cb29">func index(after i: Substring.Index) -> Substring.Index</a> <span class="required">Required</span><div class="comment collapse in" id="comment-index_after-976478ce790c064a72519919a525cb29"><p>Returns the position immediately after the given index.</p>
<p>The successor of an index must be well defined. For an index <code>i</code> into a
collection <code>c</code>, calling <code>c.index(after: i)</code> returns the same index every
time.</p>
<ul>
<li>Parameter i: A valid index of the collection. <code>i</code> must be less than
<code>endIndex</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public func index(after i: Substring.Index) -> Substring.Index</code></div></div><div id="index_before-ee7e993bbd939c71d46566c977277662" class="declaration"><a class="toggle-link" href="#comment-index_before-ee7e993bbd939c71d46566c977277662">func index(before i: Substring.Index) -> Substring.Index</a> <span class="required">Required</span><div class="comment collapse in" id="comment-index_before-ee7e993bbd939c71d46566c977277662"><p>Returns the position immediately before the given index.</p>
<ul>
<li>Parameter i: A valid index of the collection. <code>i</code> must be greater than
<code>startIndex</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public func index(before i: Substring.Index) -> Substring.Index</code></div></div><div id="insert_at-2422c5a8ae5e7107d8c851b9681eb071" class="declaration"><a class="toggle-link" href="#comment-insert_at-2422c5a8ae5e7107d8c851b9681eb071">func insert(_ newElement: Self.Element, at i: Self.Index)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-insert_at-2422c5a8ae5e7107d8c851b9681eb071"><p>Inserts a new element into the collection at the specified position.</p>
<p>The new element is inserted before the element currently at the
specified index. If you pass the collection's <code>endIndex</code> property as
the <code>index</code> parameter, the new element is appended to the
collection.</p>
<pre><code class="language-swift">var numbers = [1, 2, 3, 4, 5]
numbers.insert(100, at: 3)
numbers.insert(200, at: numbers.endIndex)

print(numbers)
// Prints &quot;[1, 2, 3, 100, 4, 5, 200]&quot;
</code></pre>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<ul>
<li>Parameter newElement: The new element to insert into the collection.</li>
</ul>
<ul>
<li>Parameter i: The position at which to insert the new element.
<code>index</code> must be a valid index into the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection. If <code>i == endIndex</code>, this method is equivalent to <code>append(_:)</code>.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func insert(_ newElement: Self.Element, at i: Self.Index)</code></div></div><div id="insert_contentsOf_at-c903317351c7d5642de7c18c61788233" class="declaration"><a class="toggle-link" href="#comment-insert_contentsOf_at-c903317351c7d5642de7c18c61788233">func insert(contentsOf newElements: C, at i: Self.Index)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-insert_contentsOf_at-c903317351c7d5642de7c18c61788233"><p>Inserts the elements of a sequence into the collection at the specified
position.</p>
<p>The new elements are inserted before the element currently at the
specified index. If you pass the collection's <code>endIndex</code> property as the
<code>index</code> parameter, the new elements are appended to the collection.</p>
<p>Here's an example of inserting a range of integers into an array of the
same type:</p>
<pre><code class="language-swift">var numbers = [1, 2, 3, 4, 5]
numbers.insert(contentsOf: 100...103, at: 3)
print(numbers)
// Prints &quot;[1, 2, 3, 100, 101, 102, 103, 4, 5]&quot;
</code></pre>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<ul>
<li>Parameter newElements: The new elements to insert into the collection.</li>
</ul>
<ul>
<li>Parameter i: The position at which to insert the new elements. <code>index</code>
must be a valid index of the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em> + <em>m</em>), where <em>n</em> is length of this collection and <em>m</em> is the length of <code>newElements</code>. If <code>i == endIndex</code>, this method is equivalent to <code>append(contentsOf:)</code>.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func insert&lt;C>(contentsOf newElements: C, at i: Self.Index) where C: Collection, Self.Element == C.Element</code></div></div><div id="lowercased-29ba18707683dbcba3cb456c027a71f1" class="declaration"><a class="toggle-link" href="#comment-lowercased-29ba18707683dbcba3cb456c027a71f1">func lowercased() -> String</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lowercased-29ba18707683dbcba3cb456c027a71f1"><h4>Declaration</h4><code class="language-swift">public func lowercased() -> String</code></div></div><div id="makeContiguousUTF-a844e9a4d44c3964c718fb53f17767f6" class="declaration"><a class="toggle-link" href="#comment-makeContiguousUTF-a844e9a4d44c3964c718fb53f17767f6">func makeContiguousUTF8()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-makeContiguousUTF-a844e9a4d44c3964c718fb53f17767f6"><p>If this string is not contiguous, make it so. If this mutates the
substring, it will invalidate any pre-existing indices.</p>
<p>Complexity: O(n) if non-contiguous, O(1) if already contiguous</p>
<h4>Declaration</h4><code class="language-swift">public mutating func makeContiguousUTF8()</code></div></div><div id="remove_at-3e0c9900dc44c20e5d46b7cd3b677435" class="declaration"><a class="toggle-link" href="#comment-remove_at-3e0c9900dc44c20e5d46b7cd3b677435">func remove(at position: Self.Index) -> Self.Element</a> <span class="required">Required</span><div class="comment collapse in" id="comment-remove_at-3e0c9900dc44c20e5d46b7cd3b677435"><p>Removes and returns the element at the specified position.</p>
<p>All the elements following the specified position are moved to close the
gap. This example removes the middle element from an array of
measurements.</p>
<pre><code class="language-swift">var measurements = [1.2, 1.5, 2.9, 1.2, 1.6]
let removed = measurements.remove(at: 2)
print(measurements)
// Prints &quot;[1.2, 1.5, 1.2, 1.6]&quot;
</code></pre>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<ul>
<li>Parameter position: The position of the element to remove. <code>position</code>
must be a valid index of the collection that is not equal to the
collection's end index.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func remove(at position: Self.Index) -> Self.Element</code></div></div><div id="removeAll_keepingCapacity-258ecaf1c68e3810fad8df6f24bcd010" class="declaration"><a class="toggle-link" href="#comment-removeAll_keepingCapacity-258ecaf1c68e3810fad8df6f24bcd010">func removeAll(keepingCapacity keepCapacity: Bool = false)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-removeAll_keepingCapacity-258ecaf1c68e3810fad8df6f24bcd010"><p>Removes all elements from the collection.</p>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<ul>
<li>Parameter keepCapacity: Pass <code>true</code> to request that the collection
avoid releasing its storage. Retaining the collection's storage can
be a useful optimization when you're planning to grow the collection
again. The default value is <code>false</code>.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func removeAll(keepingCapacity keepCapacity: Bool = false)</code></div></div><div id="removeAll_where-78f1ec47693ca0c39027cef2bf1c64be" class="declaration"><a class="toggle-link" href="#comment-removeAll_where-78f1ec47693ca0c39027cef2bf1c64be">func removeAll(where shouldBeRemoved: (Self.Element) throws -> Bool) rethrows</a> <span class="required">Required</span><div class="comment collapse in" id="comment-removeAll_where-78f1ec47693ca0c39027cef2bf1c64be"><p>Removes all the elements that satisfy the given predicate.</p>
<p>Use this method to remove every element in a collection that meets
particular criteria. The order of the remaining elements is preserved.
This example removes all the vowels from a string:</p>
<pre><code class="language-swift">var phrase = &quot;The rain in Spain stays mainly in the plain.&quot;

let vowels: Set&lt;Character&gt; = [&quot;a&quot;, &quot;e&quot;, &quot;i&quot;, &quot;o&quot;, &quot;u&quot;]
phrase.removeAll(where: { vowels.contains($0) })
// phrase == &quot;Th rn n Spn stys mnly n th pln.&quot;
</code></pre>
<ul>
<li>Parameter shouldBeRemoved: A closure that takes an element of the
sequence as its argument and returns a Boolean value indicating
whether the element should be removed from the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func removeAll(where shouldBeRemoved: (Self.Element) throws -> Bool) rethrows</code></div></div><div id="removeFirst-90bb9af594748b627d638a3b28d286c7" class="declaration"><a class="toggle-link" href="#comment-removeFirst-90bb9af594748b627d638a3b28d286c7">func removeFirst() -> Self.Element</a> <span class="required">Required</span><div class="comment collapse in" id="comment-removeFirst-90bb9af594748b627d638a3b28d286c7"><p>Removes and returns the first element of the collection.</p>
<p>The collection must not be empty.</p>
<pre><code class="language-swift">var bugs = [&quot;Aphid&quot;, &quot;Bumblebee&quot;, &quot;Cicada&quot;, &quot;Damselfly&quot;, &quot;Earwig&quot;]
bugs.removeFirst()
print(bugs)
// Prints &quot;[&quot;Bumblebee&quot;, &quot;Cicada&quot;, &quot;Damselfly&quot;, &quot;Earwig&quot;]&quot;
</code></pre>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func removeFirst() -> Self.Element</code></div></div><div id="removeFirst-38c26d3d2ce7e1284c4720b69bb07b0c" class="declaration"><a class="toggle-link" href="#comment-removeFirst-38c26d3d2ce7e1284c4720b69bb07b0c">func removeFirst(_ k: Int)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-removeFirst-38c26d3d2ce7e1284c4720b69bb07b0c"><p>Removes the specified number of elements from the beginning of the
collection.</p>
<pre><code class="language-swift">var bugs = [&quot;Aphid&quot;, &quot;Bumblebee&quot;, &quot;Cicada&quot;, &quot;Damselfly&quot;, &quot;Earwig&quot;]
bugs.removeFirst(3)
print(bugs)
// Prints &quot;[&quot;Damselfly&quot;, &quot;Earwig&quot;]&quot;
</code></pre>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<ul>
<li>Parameter k: The number of elements to remove from the collection.
<code>k</code> must be greater than or equal to zero and must not exceed the
number of elements in the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func removeFirst(_ k: Int)</code></div></div><div id="removeSubrange-879999614b8060026a48a1f66c30ac8f" class="declaration"><a class="toggle-link" href="#comment-removeSubrange-879999614b8060026a48a1f66c30ac8f">func removeSubrange(_ bounds: Range&lt;Self.Index>)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-removeSubrange-879999614b8060026a48a1f66c30ac8f"><p>Removes the elements in the specified subrange from the collection.</p>
<p>All the elements following the specified position are moved to close the
gap. This example removes three elements from the middle of an array of
measurements.</p>
<pre><code class="language-swift">var measurements = [1.2, 1.5, 2.9, 1.2, 1.5]
measurements.removeSubrange(1..&lt;4)
print(measurements)
// Prints &quot;[1.2, 1.5]&quot;
</code></pre>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<ul>
<li>Parameter bounds: The range of the collection to be removed. The
bounds of the range must be valid indices of the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func removeSubrange(_ bounds: Range&lt;Self.Index>)</code></div></div><div id="removeSubrange-879999614b8060026a48a1f66c30ac8f" class="declaration"><a class="toggle-link" href="#comment-removeSubrange-879999614b8060026a48a1f66c30ac8f">func removeSubrange(_ bounds: R)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-removeSubrange-879999614b8060026a48a1f66c30ac8f"><p>Removes the elements in the specified subrange from the collection.</p>
<p>All the elements following the specified position are moved to close the
gap. This example removes three elements from the middle of an array of
measurements.</p>
<pre><code class="language-swift">var measurements = [1.2, 1.5, 2.9, 1.2, 1.5]
measurements.removeSubrange(1..&lt;4)
print(measurements)
// Prints &quot;[1.2, 1.5]&quot;
</code></pre>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<ul>
<li>Parameter bounds: The range of the collection to be removed. The
bounds of the range must be valid indices of the collection.</li>
</ul>
<blockquote>
<p>Complexity:
O(<em>n</em>), where <em>n</em> is the length of the collection.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func removeSubrange&lt;R>(_ bounds: R) where R: RangeExpression, Self.Index == R.Bound</code></div></div><div id="replaceSubrange_with-37f24f980773f1736abe2f2109e3c177" class="declaration"><a class="toggle-link" href="#comment-replaceSubrange_with-37f24f980773f1736abe2f2109e3c177">func replaceSubrange(_ bounds: Range&lt;Substring.Index>, with newElements: C)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-replaceSubrange_with-37f24f980773f1736abe2f2109e3c177"><p>Replaces the specified subrange of elements with the given collection.</p>
<p>This method has the effect of removing the specified range of elements
from the collection and inserting the new elements at the same location.
The number of new elements need not match the number of elements being
removed.</p>
<p>In this example, three elements in the middle of an array of integers are
replaced by the five elements of a <code>Repeated&lt;Int&gt;</code> instance.</p>
<pre><code class="language-swift"> var nums = [10, 20, 30, 40, 50]
 nums.replaceSubrange(1...3, with: repeatElement(1, count: 5))
 print(nums)
 // Prints &quot;[10, 1, 1, 1, 1, 1, 50]&quot;
</code></pre>
<p>If you pass a zero-length range as the <code>subrange</code> parameter, this method
inserts the elements of <code>newElements</code> at <code>subrange.startIndex</code>. Calling
the <code>insert(contentsOf:at:)</code> method instead is preferred.</p>
<p>Likewise, if you pass a zero-length collection as the <code>newElements</code>
parameter, this method removes the elements in the given subrange
without replacement. Calling the <code>removeSubrange(_:)</code> method instead is
preferred.</p>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<blockquote>
<p>Complexity:
O(<em>n</em> + <em>m</em>), where <em>n</em> is length of this collection and <em>m</em> is the length of <code>newElements</code>. If the call to this method simply appends the contents of <code>newElements</code> to the collection, this method is equivalent to <code>append(contentsOf:)</code>.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">public mutating func replaceSubrange&lt;C>(_ bounds: Range&lt;Substring.Index>, with newElements: C) where C: Collection, C.Element == Substring.Iterator.Element</code></div></div><div id="replaceSubrange_with-37f24f980773f1736abe2f2109e3c177" class="declaration"><a class="toggle-link" href="#comment-replaceSubrange_with-37f24f980773f1736abe2f2109e3c177">func replaceSubrange(_ bounds: Range&lt;Substring.Index>, with newElements: Substring)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-replaceSubrange_with-37f24f980773f1736abe2f2109e3c177"><h4>Declaration</h4><code class="language-swift">public mutating func replaceSubrange(_ bounds: Range&lt;Substring.Index>, with newElements: Substring)</code></div></div><div id="replaceSubrange_with-37f24f980773f1736abe2f2109e3c177" class="declaration"><a class="toggle-link" href="#comment-replaceSubrange_with-37f24f980773f1736abe2f2109e3c177">func replaceSubrange(_ subrange: R, with newElements: C)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-replaceSubrange_with-37f24f980773f1736abe2f2109e3c177"><p>Replaces the specified subrange of elements with the given collection.</p>
<p>This method has the effect of removing the specified range of elements
from the collection and inserting the new elements at the same location.
The number of new elements need not match the number of elements being
removed.</p>
<p>In this example, three elements in the middle of an array of integers are
replaced by the five elements of a <code>Repeated&lt;Int&gt;</code> instance.</p>
<pre><code class="language-swift"> var nums = [10, 20, 30, 40, 50]
 nums.replaceSubrange(1...3, with: repeatElement(1, count: 5))
 print(nums)
 // Prints &quot;[10, 1, 1, 1, 1, 1, 50]&quot;
</code></pre>
<p>If you pass a zero-length range as the <code>subrange</code> parameter, this method
inserts the elements of <code>newElements</code> at <code>subrange.startIndex</code>. Calling
the <code>insert(contentsOf:at:)</code> method instead is preferred.</p>
<p>Likewise, if you pass a zero-length collection as the <code>newElements</code>
parameter, this method removes the elements in the given subrange
without replacement. Calling the <code>removeSubrange(_:)</code> method instead is
preferred.</p>
<p>Calling this method may invalidate any existing indices for use with this
collection.</p>
<blockquote>
<p>Complexity:
O(<em>n</em> + <em>m</em>), where <em>n</em> is length of this collection and <em>m</em> is the length of <code>newElements</code>. If the call to this method simply appends the contents of <code>newElements</code> to the collection, the complexity is O(<em>m</em>).</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func replaceSubrange&lt;C, R>(_ subrange: R, with newElements: C) where C: Collection, R: RangeExpression, Self.Element == C.Element, Self.Index == R.Bound</code></div></div><div id="reserveCapacity-f5185bdad5243d37ae23c866665e584b" class="declaration"><a class="toggle-link" href="#comment-reserveCapacity-f5185bdad5243d37ae23c866665e584b">func reserveCapacity(_ n: Int)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-reserveCapacity-f5185bdad5243d37ae23c866665e584b"><p>Prepares the collection to store the specified number of elements, when
doing so is appropriate for the underlying type.</p>
<p>If you will be adding a known number of elements to a collection, use
this method to avoid multiple reallocations. A type that conforms to
<code>RangeReplaceableCollection</code> can choose how to respond when this method
is called. Depending on the type, it may make sense to allocate more or
less storage than requested or to take no action at all.</p>
<ul>
<li>Parameter n: The requested number of elements to store.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public mutating func reserveCapacity(_ n: Int)</code></div></div><div id="uppercased-b2325f56718bd5f485736afc15cf40c6" class="declaration"><a class="toggle-link" href="#comment-uppercased-b2325f56718bd5f485736afc15cf40c6">func uppercased() -> String</a> <span class="required">Required</span><div class="comment collapse in" id="comment-uppercased-b2325f56718bd5f485736afc15cf40c6"><h4>Declaration</h4><code class="language-swift">public func uppercased() -> String</code></div></div><div id="withCString-d3871ec370a17d93f46ca97505aae9fe" class="declaration"><a class="toggle-link" href="#comment-withCString-d3871ec370a17d93f46ca97505aae9fe">func withCString(_ body: (UnsafePointer&lt;CChar>) throws -> Result) rethrows -> Result</a> <span class="required">Required</span><div class="comment collapse in" id="comment-withCString-d3871ec370a17d93f46ca97505aae9fe"><p>Calls the given closure with a pointer to the contents of the string,
represented as a null-terminated sequence of UTF-8 code units.</p>
<p>The pointer passed as an argument to <code>body</code> is valid only during the
execution of <code>withCString(_:)</code>. Do not store or return the pointer for
later use.</p>
<ul>
<li>Parameter body: A closure with a pointer parameter that points to a
null-terminated sequence of UTF-8 code units. If <code>body</code> has a return
value, that value is also used as the return value for the
<code>withCString(_:)</code> method. The pointer argument is valid only for the
duration of the method's execution.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public func withCString&lt;Result>(_ body: (UnsafePointer&lt;CChar>) throws -> Result) rethrows -> Result</code></div></div><div id="withCString_encodedAs-0f41b6f994c07361fa528fb4166467e0" class="declaration"><a class="toggle-link" href="#comment-withCString_encodedAs-0f41b6f994c07361fa528fb4166467e0">func withCString(encodedAs targetEncoding: TargetEncoding.Type, _ body: (UnsafePointer&lt;TargetEncoding.CodeUnit>) throws -> Result) rethrows -> Result</a> <span class="required">Required</span><div class="comment collapse in" id="comment-withCString_encodedAs-0f41b6f994c07361fa528fb4166467e0"><p>Calls the given closure with a pointer to the contents of the string,
represented as a null-terminated sequence of code units.</p>
<p>The pointer passed as an argument to <code>body</code> is valid only during the
execution of <code>withCString(encodedAs:_:)</code>. Do not store or return the
pointer for later use.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public func withCString&lt;Result, TargetEncoding>(encodedAs targetEncoding: TargetEncoding.Type, _ body: (UnsafePointer&lt;TargetEncoding.CodeUnit>) throws -> Result) rethrows -> Result where TargetEncoding: _UnicodeEncoding</code></div></div><div id="withUTF-5b958f60be09b0148cab41887e3a64bd" class="declaration"><a class="toggle-link" href="#comment-withUTF-5b958f60be09b0148cab41887e3a64bd">func withUTF8(_ body: (UnsafeBufferPointer&lt;UInt8>) throws -> R) rethrows -> R</a> <span class="required">Required</span><div class="comment collapse in" id="comment-withUTF-5b958f60be09b0148cab41887e3a64bd"><p>Runs <code>body</code> over the content of this substring in contiguous memory. If
this substring is not contiguous, this will first make it contiguous,
which will also speed up subsequent access. If this mutates the substring,
it will invalidate any pre-existing indices.</p>
<p>Note that it is unsafe to escape the pointer provided to <code>body</code>. For
example, strings of up to 15 UTF-8 code units in length may be represented
in a small-string representation, and thus will be spilled into
temporary stack space which is invalid after <code>withUTF8</code> finishes
execution.</p>
<p>Complexity: O(n) if non-contiguous, O(1) if already contiguous</p>
<h4>Declaration</h4><code class="language-swift">public mutating func withUTF8&lt;R>(_ body: (UnsafeBufferPointer&lt;UInt8>) throws -> R) rethrows -> R</code></div></div><div id="write-8a0b06b688402ed7e1a24c09bf3ddfc1" class="declaration"><a class="toggle-link" href="#comment-write-8a0b06b688402ed7e1a24c09bf3ddfc1">func write(_ other: String)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-write-8a0b06b688402ed7e1a24c09bf3ddfc1"><p>Appends the given string to the stream.</p>
<h4>Declaration</h4><code class="language-swift">public mutating func write(_ other: String)</code></div></div><div id="write_to-d457d816b415ff3bee040fb06f595e0f" class="declaration"><a class="toggle-link" href="#comment-write_to-d457d816b415ff3bee040fb06f595e0f">func write(to target: inout Target)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-write_to-d457d816b415ff3bee040fb06f595e0f"><p>Writes a textual representation of this instance into the given output
stream.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public func write&lt;Target>(to target: inout Target) where Target: TextOutputStream</code></div></div><h3>Type Methods</h3><div id="lhs_rhs-a606646d54567350092f2c9a8c1adc2d" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-a606646d54567350092f2c9a8c1adc2d">func !=(lhs: Self, rhs: RHS) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-a606646d54567350092f2c9a8c1adc2d"><h4>Declaration</h4><code class="language-swift">@inlinable public static func !=&lt;RHS>(lhs: Self, rhs: RHS) -> Bool where RHS: StringProtocol</code></div></div><div id="lhs_rhs-1ace6c0ccceecc18799beae40fae2402" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402">func +(lhs: Self, rhs: Other) -> Self</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402"><p>Creates a new collection by concatenating the elements of a collection and
a sequence.</p>
<p>The two arguments must have the same <code>Element</code> type. For example, you can
concatenate the elements of an integer array and a <code>Range&lt;Int&gt;</code> instance.</p>
<pre><code class="language-swift">let numbers = [1, 2, 3, 4]
let moreNumbers = numbers + 5...10
print(moreNumbers)
// Prints &quot;[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]&quot;
</code></pre>
<p>The resulting collection has the type of the argument on the left-hand
side. In the example above, <code>moreNumbers</code> has the same type as <code>numbers</code>,
which is <code>[Int]</code>.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func +&lt;Other>(lhs: Self, rhs: Other) -> Self where Other: Sequence, Self.Element == Other.Element</code></div></div><div id="lhs_rhs-1ace6c0ccceecc18799beae40fae2402" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402">func +(lhs: Other, rhs: Self) -> Self</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402"><p>Creates a new collection by concatenating the elements of a sequence and a
collection.</p>
<p>The two arguments must have the same <code>Element</code> type. For example, you can
concatenate the elements of a <code>Range&lt;Int&gt;</code> instance and an integer array.</p>
<pre><code class="language-swift">let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints &quot;[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]&quot;
</code></pre>
<p>The resulting collection has the type of argument on the right-hand side.
In the example above, <code>moreNumbers</code> has the same type as <code>numbers</code>, which
is <code>[Int]</code>.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func +&lt;Other>(lhs: Other, rhs: Self) -> Self where Other: Sequence, Self.Element == Other.Element</code></div></div><div id="lhs_rhs-1ace6c0ccceecc18799beae40fae2402" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402">func +(lhs: Self, rhs: Other) -> Self</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402"><p>Creates a new collection by concatenating the elements of two collections.</p>
<p>The two arguments must have the same <code>Element</code> type. For example, you can
concatenate the elements of two integer arrays.</p>
<pre><code class="language-swift">let lowerNumbers = [1, 2, 3, 4]
let higherNumbers: ContiguousArray = [5, 6, 7, 8, 9, 10]
let allNumbers = lowerNumbers + higherNumbers
print(allNumbers)
// Prints &quot;[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]&quot;
</code></pre>
<p>The resulting collection has the type of the argument on the left-hand
side. In the example above, <code>moreNumbers</code> has the same type as <code>numbers</code>,
which is <code>[Int]</code>.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func +&lt;Other>(lhs: Self, rhs: Other) -> Self where Other: RangeReplaceableCollection, Self.Element == Other.Element</code></div></div><div id="lhs_rhs-7b743b7b721afe0b0efa21dcf331e0fb" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-7b743b7b721afe0b0efa21dcf331e0fb">func +=(lhs: inout Self, rhs: Other)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-7b743b7b721afe0b0efa21dcf331e0fb"><p>Appends the elements of a sequence to a range-replaceable collection.</p>
<p>Use this operator to append the elements of a sequence to the end of
range-replaceable collection with same <code>Element</code> type. This example
appends the elements of a <code>Range&lt;Int&gt;</code> instance to an array of integers.</p>
<pre><code class="language-swift">var numbers = [1, 2, 3, 4, 5]
numbers += 10...15
print(numbers)
// Prints &quot;[1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]&quot;
</code></pre>
<blockquote>
<p>Complexity:
O(<em>m</em>), where <em>m</em> is the length of the right-hand-side argument.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func +=&lt;Other>(lhs: inout Self, rhs: Other) where Other: Sequence, Self.Element == Other.Element</code></div></div><div id="lhs_rhs-fd1eb92a63f65c4a12e77f2bca10240f" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-fd1eb92a63f65c4a12e77f2bca10240f">func &lt;(lhs: Self, rhs: RHS) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-fd1eb92a63f65c4a12e77f2bca10240f"><p>Returns a Boolean value indicating whether the value of the first
argument is less than that of the second argument.</p>
<p>This function is the only requirement of the <code>Comparable</code> protocol. The
remainder of the relational operator functions are implemented by the
standard library for any type that conforms to <code>Comparable</code>.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func &lt;&lt;RHS>(lhs: Self, rhs: RHS) -> Bool where RHS: StringProtocol</code></div></div><div id="lhs_rhs-cc639dad42d3ea71f6f367b80a3ccb92" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-cc639dad42d3ea71f6f367b80a3ccb92">func &lt;=(lhs: Self, rhs: RHS) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-cc639dad42d3ea71f6f367b80a3ccb92"><p>Returns a Boolean value indicating whether the value of the first
argument is less than or equal to that of the second argument.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func &lt;=&lt;RHS>(lhs: Self, rhs: RHS) -> Bool where RHS: StringProtocol</code></div></div><div id="lhs_rhs-28a45cba8101c0b1017a22535b8b2710" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-28a45cba8101c0b1017a22535b8b2710">func ==(lhs: Self, rhs: RHS) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-28a45cba8101c0b1017a22535b8b2710"><p>Returns a Boolean value indicating whether two values are equal.</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func ==&lt;RHS>(lhs: Self, rhs: RHS) -> Bool where RHS: StringProtocol</code></div></div><div id="lhs_rhs-a00561663d495dd2668b929fde178932" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-a00561663d495dd2668b929fde178932">func >(lhs: Self, rhs: RHS) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-a00561663d495dd2668b929fde178932"><p>Returns a Boolean value indicating whether the value of the first
argument is greater than that of the second argument.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func >&lt;RHS>(lhs: Self, rhs: RHS) -> Bool where RHS: StringProtocol</code></div></div><div id="lhs_rhs-a0e01127094d0eee401411c4b5eb8e60" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-a0e01127094d0eee401411c4b5eb8e60">func >=(lhs: Self, rhs: RHS) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-a0e01127094d0eee401411c4b5eb8e60"><p>Returns a Boolean value indicating whether the value of the first
argument is greater than or equal to that of the second argument.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func >=&lt;RHS>(lhs: Self, rhs: RHS) -> Bool where RHS: StringProtocol</code></div></div>